<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
    <div id="example">
        <p>{{message}}</p>
        <p>{{reverse}}</p>
    </div>
    <script>
        let vm=new Vue({
            el:'#example',
            data:{
                message:'HELLO'
            },
            computed:{
                reverse(){
                    return this.message.split('').reverse().join('');
                }
                //这里是声明了一个计算属性reverse，提供的函数将作用于property的getter函数
                
            }
        })
        //这里可以是输出上面的computed函数
        console.log(vm.reverse);
    </script>

    <div id="demo">
        {{fullName}}
    </div>

    <script>
        let cm=new Vue({
            el:'#demo',
            data:{
                fristName:'Foo',
                lastName:'Bar',
                fullName:'Foo Bar'
            },
            watch:{
                fristName(val){
                    this.fullName=val+' '+this,lastName
                },
                lastName(val){
                    this.fullName=this.fristName+' '+val
                }
            }
        })
    </script>
</body>
</html>